package com.ruoyi.rescue.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rescue.domain.CheGroupBuying;
import com.ruoyi.rescue.mapper.CheGroupBuyingMapper;
import com.ruoyi.rescue.service.ICheGroupBuyingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 优惠团购Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-06-05
 */
@Service
public class CheGroupBuyingServiceImpl implements ICheGroupBuyingService
{
    @Autowired
    private CheGroupBuyingMapper cheGroupBuyingMapper;

    /**
     * 查询优惠团购
     * 
     * @param id 优惠团购主键
     * @return 优惠团购
     */
    @Override
    public CheGroupBuying selectCheGroupBuyingById(Long id)
    {
        return cheGroupBuyingMapper.selectCheGroupBuyingById(id);
    }

    /**
     * 查询优惠团购列表
     * 
     * @param cheGroupBuying 优惠团购
     * @return 优惠团购
     */
    @Override
    public List<CheGroupBuying> selectCheGroupBuyingList(CheGroupBuying cheGroupBuying)
    {
        return cheGroupBuyingMapper.selectCheGroupBuyingList(cheGroupBuying);
    }

    /**
     * 新增优惠团购
     * 
     * @param cheGroupBuying 优惠团购
     * @return 结果
     */
    @Override
    public int insertCheGroupBuying(CheGroupBuying cheGroupBuying)
    {
        cheGroupBuying.setCreateTime(DateUtils.getNowDate());
        return cheGroupBuyingMapper.insertCheGroupBuying(cheGroupBuying);
    }

    /**
     * 修改优惠团购
     * 
     * @param cheGroupBuying 优惠团购
     * @return 结果
     */
    @Override
    public int updateCheGroupBuying(CheGroupBuying cheGroupBuying)
    {
        return cheGroupBuyingMapper.updateCheGroupBuying(cheGroupBuying);
    }

    /**
     * 批量删除优惠团购
     * 
     * @param ids 需要删除的优惠团购主键
     * @return 结果
     */
    @Override
    public int deleteCheGroupBuyingByIds(Long[] ids)
    {
        return cheGroupBuyingMapper.deleteCheGroupBuyingByIds(ids);
    }

    /**
     * 删除优惠团购信息
     * 
     * @param id 优惠团购主键
     * @return 结果
     */
    @Override
    public int deleteCheGroupBuyingById(Long id)
    {
        return cheGroupBuyingMapper.deleteCheGroupBuyingById(id);
    }
}
